package ch;

import java.util.HashMap;
import java.util.TreeMap;

/**
 * 一致性hash测试
 *
 * @author yuh
 * @date 2018/4/26 16:37
 */
public class Main {

    public static void main(String[] args) {
       /* MapConsistentHash<String> hash = new MapConsistentHash<>();
        for (int i = 100; i < 105; i++) {
            hash.addServerNode(i, new TreeMap<>());
        }
        for (int i = 0; i < 5; i++) {
            hash.add(String.valueOf(i), String.valueOf(i));
        }
        for (int i = 0; i < 5; i++) {
            System.out.println(hash.get(String.valueOf(i)));
        }
        for (int i = 0; i < 5; i++) {
            hash.addServerNode(i , new TreeMap<>());
        }*/

        System.out.println(is2Times(4));
    }

    static boolean is2Times(int n) {
        boolean f = false;
        for (int i = 2; i <= n; i *= 2) {
            if(i == n){
                f = true;
            }
        }
        return f;
    }


}
